﻿using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using DiscoveryLogic.UI.Layouts.ContentScreens;
using DiscoveryLogic.DataServices.DataSources;

namespace DiscoveryLogic.UI.Layouts.Controls
{
    public partial class FundLegend : UserControl
    {

        #region Private Variables

            private FundTypes fundType;
            
        #endregion

        #region Constructors

            public FundLegend(FundTypes fundType, double textLeft, double textTop)
            {
                // Required to initialize variables
                InitializeComponent();

                this.fundType = fundType;

                SwitchFundType(this.fundType);

                LegendLabel.SetValue(Canvas.LeftProperty, textLeft);
                LegendLabel.SetValue(Canvas.TopProperty, textTop);

            }

        #endregion

        #region Public Methods

            public FundTypes GetFundType()
            {
                return fundType;
            }

            public void SwitchFundType(FundTypes fundType)
            {
                // Set all to invisible
                DomesticEquityCanvas.Opacity = 0;
                DomesticBondsCanvas.Opacity = 0;
                ForeignEquityCanvas.Opacity = 0;
                ForeignBondsCanvas.Opacity = 0;
                ShortTermCanvas.Opacity = 0;
                OtherCanvas.Opacity = 0;

                // Only set the one we want to visible
                if (fundType == FundTypes.DomesticEquity)
                {
                    DomesticEquityCanvas.Opacity = 1;
                    LegendLabel.Text = (string)Resources["Res_DomesticEquityLegend"];
                }
                else if (fundType == FundTypes.DomesticBonds)
                {
                    DomesticBondsCanvas.Opacity = 1;
                    LegendLabel.Text = (string)Resources["Res_DomesticBondsLegend"];
                }
                else if (fundType == FundTypes.ForeignEquity)
                {
                    ForeignEquityCanvas.Opacity = 1;
                    LegendLabel.Text = (string)Resources["Res_ForeignEquityLegend"];
                }
                else if (fundType == FundTypes.ForeignBonds)
                {
                    ForeignBondsCanvas.Opacity = 1;
                    LegendLabel.Text = (string)Resources["Res_ForeignBondsLegend"];
                }
                else if (fundType == FundTypes.ShortTerm)
                {
                    ShortTermCanvas.Opacity = 1;
                    LegendLabel.Text = (string)Resources["Res_ShortTermLegend"];
                }
                else
                {
                    OtherCanvas.Opacity = 1;
                    LegendLabel.Text = (string)Resources["Res_OtherLegend"];
                }
            }

        #endregion

    }
}
